COMPILER = gcc
CPPFLAGS = -Wall -c
LIBRARIES =-lprotobuf -lpthread

bufdbClient.exe: ClientSocket.o Socket.o database.pb.o bufdbClient.o
	$(COMPILER) ClientSocket.o Socket.o database.pb.o bufdbClient.o -o bufdbClient.exe $(LIBRARIES)
       
bufdbClient.o: bufdbClient.cpp
	$(COMPILER) $(CPPFLAGS) bufdbClient.cpp -o bufdbClient.o $(LIBRARIES)
	
ClientSocket.o: ClientSocket.cpp ClientSocket.h
	$(COMPILER) $(CPPFLAGS) ClientSocket.cpp -o ClientSocket.o $(LIBRARIES)
	
database.pb.o: database.pb.cc database.pb.h
	$(COMPILER) $(CPPFLAGS) database.pb.cc -o database.pb.o $(LIBRARIES)	

bufdbServerMain: ServerSocket.o Socket.o bufdbServerMain.o database.pb.o
	$(COMPILER) -o bufdbServerMain ServerSocket.o Socket.o database.pb.o bufdbServerMain.o $(LIBRARIES)
	
ServerSocket.o: ServerSocket.cpp ServerSocket.h
	$(COMPILER) $(CPPFLAGS) ServerSocket.cpp -o ServerSocket.o $(LIBRARIES)
		
Socket.o: Socket.cpp Socket.h
	$(COMPILER) $(CPPFLAGS) Socket.cpp -o Socket.o $(LIBRARIES)

bufdbServerMain.o: bufdbServerMain.cpp		
	$(COMPILER) $(CPPFLAGS) bufdbServerMain.cpp -o bufdbServerMain.o $(LIBRARIES)	

       
.PHONY:clean

clean:
	rm --force ./*.o
	rm --force ./*.exe
